package zy.blogs.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import zy.blogs.entity.ParkingLot;
import zy.blogs.entity.SysUser;

import java.util.List;

@Mapper
public interface ParkingLotMapper extends BaseMapper<ParkingLot> {
    @Results({
            @Result(column = "id",property="id"),
            @Result(column = "pricing_standard_id",property = "pricingStandard",one =@One(select = "com.zy.mapper.PricingStandardMapper.selectById")),
    })
    @Select("select * from parking_lot join pricing_standard on "
            +"pricing_standard.id=parking_lot.pricing_standard_id")
    List<ParkingLot> getAll();
    @Results({
            @Result(column = "id",property="id"),
            @Result(column = "pricing_standard_id",property = "pricingStandard",one =@One(select = "com.zy.mapper.PricingStandardMapper.selectById")),
    })
    @Select("select * from parking_lot join pricing_standard"
            +"on pricing_standard.id=parking_lot.pricing_standard_id"
            +"where parking_lot.id=#{id}")
    ParkingLot getById(Long id);

    @Insert("insert into parking_lot set "
            +"name=#{name}volumetric=#{volumetric} "
            +"pricing_standard_id=#{prcingStandard.id}")
    int insert(ParkingLot entity);

    @Update("insert into parking_lot set name=#{name}"+
            "volumetric=#{volumetric} pricing_standard_id"+
            "=#{pricingStandard.id}")
    int Update(ParkingLot entity);
    int update(ParkingLot entity);
    // int insert(ParkingLot entity);


}
